package chixing.day05;

/**
 * 店铺类：
 * public：由public修饰的属性，方法，类，其他类都能访问
 * private：由private修饰的属性，方法，类，只有本类才能访问
 * 用private的原因是：增加安全性，降低耦合性
 *      （1）安全性：元数据不被暴露；
 *      （2）耦合性：该类的属性只能由自己管理
 * this：当前对象(谁调用该方法谁就是当前对象)
 * 方法重载（overload）：
 * 1.方法名称相同
 * 2.参数个数不同
 * 3.参数类型不同
 * 4.顺序不一样

 * 无参构造放在get（）set（）上面
 */
public class Shop {
    private int shopId;//店铺id
    private String shopName;//店铺名称
    private String branchName;//店铺地址
    private float shopScore;//店铺评分

    //无参构造默认省略 constructor constructor
    //构造函数的作用是  初始化对象->（initial object)/ini/init
    public Shop(){}

    public Shop(int shopId,String shopName){
        this.shopId=shopId;
        this.shopName=shopName;
    }

    public Shop(int id,String name,String bname,float shopScore) {
        this.shopId=id;
        this.shopName=name;
        this.branchName=bname;
        this.shopScore=shopScore;
    }

    public int getShopId() {
        return shopId;
    }

    public void setShopId(int shopId) {
        this.shopId = shopId;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public String getBranchName() {
        return branchName;
    }

    public void setBranchName(String branchName) {
        this.branchName = branchName;
    }

    public float getShopScore() {
        return shopScore;
    }
    public void setShopScore(float shopScore) {
        this.shopScore = shopScore;
    }

    public String toString(){
        return "店铺ID:"+this.getShopId() + ";" +
                "店铺名称:"+this.getShopName() + ";" +
                "店铺地址:"+this.getBranchName() + ";" +
                "店铺评分:"+this.getShopScore() + "\n";

    }
}
